<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="isg3.domain.*,java.util.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<form action="FrontController?res=descripcionEvento2.jsp" method="post">
		 <div id="arribaDcha">
		 <fieldset>
		 	<legend  style="font-family: Arial,sans-serif; font-size: 18px; color: #660000" align="center">Organización del evento</legend>
			<%	String user=(String)session.getAttribute("session.user");
		Administrador ad= new Administrador();	
		LoginManager lm=LoginManager.getInstance();
		Usuario u=lm.getUsuario(user);
		String idUser=u.getIdUsuario();
		List even = Tablon.getInstance().getEventos();
		List evenMios = ad.eventosUsuario(idUser);
		List aux=new LinkedList();
		Evento e1=null;
		
		for (Iterator it = even.iterator(); it.hasNext();){
			
			Evento e=(Evento)it.next();
			if(e.getEstadoEvento().equals("activo")){
				boolean enc=false;
				
				for (Iterator it1 = evenMios.iterator(); it1.hasNext();){
					e1 = (Evento)it1.next();
					if(!enc){				
						if(e.getIdEvento().equals(e1.getIdEvento())){
							enc=true;
						}
					}
				}
				if(!enc){
					aux.add(e);%>
					
				<%}%>
			<%}%>
		<%}%>
		
		

<select name="eventosActivos2">
	
		<%Iterator itaux=aux.iterator();
		while(itaux.hasNext()){
			Evento e2=(Evento)itaux.next();%>
		
			<option value= "<%= e2.getTituloEvento()%>"> <%= e2.getTituloEvento() %></option>
						       
		<%} %>
	
</select>
<%if(aux.isEmpty()){%>
	<input type="submit" value="Continuar" disabled="disabled"/>
<%}else{%>
	<input type="submit" value="Continuar"/>
<%} %>
			
 		 </fieldset>
 	</form>
 	<%if(u.getTipo().equals("voluntario")){%>
 		<a href="voluntariado.jsp"/> Volver al menu </a>
 	<%}else{ %>
 		<a href="miembros.jsp"/> Volver al menu </a>
 	<%} %>
</body>
</html>